import Vue from "vue";
import ElementUI from "element-ui";
import "element-ui/lib/theme-chalk/index.css";
import "../src/assets/css/main.css";
import App from "./App";
import router from "./router";
import store from "./store";
import "./icons"; // icon
import "./errorLog"; // error log
import "./permission"; // 权限
import {
  hyLog
} from "../src/utils/index";
import fetch from "./utils/fetch";
import utils from "./utils/utils";
import api from "./api/api";
import axios from "axios";
import qs from "qs";
import VModal from "vue-js-modal";
import VueLocalStorage from "vue-localstorage";
import bgLayOut from "@/components/bgLayOut/index";
import lineChart from "@/components/Charts/lineChart";
import lineChartss from "@/components/Charts/lineChartss";
import pieChart from "@/components/Charts/pieChart.vue";
import barChart from "@/components/Charts/barChart";
import ICountUp from "vue-countup-v2";
import "swiper/dist/css/swiper.css";

// 关闭生产环境调试信息
const isDebug_mode = process.env.NODE_ENV !== "production"
Vue.config.debug = isDebug_mode
Vue.config.devtools = isDebug_mode
Vue.config.productionTip = isDebug_mode

// 自定义插件的全局引入
Vue.use(ElementUI);
Vue.use(VModal);
Vue.use(VueLocalStorage);
Vue.component("bg-lay-out", bgLayOut);
Vue.component("line-chart", lineChart);
Vue.component("line-chartss", lineChartss);
Vue.component("pie-chart", pieChart);
Vue.component("bar-chart", barChart);
Vue.component("i-count-up", ICountUp);

Vue.prototype.$online = true; // 是否在线
Vue.prototype.$hyLog = hyLog; // 自定义输出，在线环境就不输出
Vue.prototype.$fetch = fetch;
Vue.prototype.$utils = utils; // 常用工具类，定义颜色等
Vue.prototype.$api = api; // api接口
Vue.prototype.$qs = qs;
axios.defaults.headers.post["Content-Type"] =
  "application/x-www-form-urlencoded";

(axios.defaults.baseURL = process.env.NODE_ENV === "development" ? "" : "/api"), // api的base_url
(axios.defaults.timeout = 5000);
Vue.prototype.$axios = axios; // api接口
Vue.config.productionTip = false;
new Vue({
  el: "#app",
  router,
  store,
  template: "<App/>",
  components: {
    App
  }
});
